﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;
using YJKTextDimension.DimCreator;

namespace YJKTextDimension.Utility
{
	public class HideDimensionFilter : ISelectionFilter
	{
		public HideDimensionFilter(string excludeDim)
		{
			this.name = excludeDim;
		}

		public bool AllowElement(Element elem)
		{
			if (!(elem is Dimension))
			{
				return false;
			}
			Dimension dimension = elem as Dimension;
			if (dimension.DimensionShape != null)
			{
				return false;
			}
			string dimFlag = DimPublicFunc.GetDimFlag(dimension);
			return string.IsNullOrEmpty(dimFlag) || !(dimFlag == this.name);
		}

		public bool AllowReference(Reference reference, XYZ position)
		{
			throw new NotImplementedException();
		}

		private string name = "";
	}
}
